﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta name="viewport" content="width=device-width"/>
<meta name="description" content="筑学堂网校" />
<meta name="keywords" content="筑学堂网校、建筑、考试"/>

<link rel="stylesheet" type="text/css" href="../../style/share/style.css">
<link rel="stylesheet" type="text/css" href="../../style/share/kczx.css">
<link rel="stylesheet" type="text/css" href="../../style/share/home_style.css">
<link rel="stylesheet" type="text/css" href="../../style/user.css">
	
<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<script type="text/javascript" src="../js/home.js"></script>

<script type="text/javascript">

	var editor = KindEditor.create('textarea[id="topic_txt"]', {
		resizeType : 0,
		allowPreviewEmoticons : false,
		allowImageUpload : false,
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist']
	});

	//取消
	function cancelEdit(topic_id){
		   $.ajax({ url: "../query_homeGroup_topic_detail/"+topic_id, 
		       success: function(result){
	           $("#mainPageDiv").html(result);
	        }
	       });
	}
	
	//保存添加
	function editTopic(topic_id){
		   
		   var topic_name =$("#topic_name").val();
		   var topic_content = editor.html();
		   
		   /* $.ajax({url: "../group_topic_edit/"+topic_id+"/"+topic_name+"/"+topic_content, 
		       success: function(result){
	           alert(result);
	           if('success'==result){
	        	   $.ajax({ url: "../query_homeGroup_topic_detail/"+topic_id, 
	    		       success: function(result){
	    	           $("#mainPageDiv").html(result);
	    	        }
	    	       });
	           }
	        }
		   }); */
		   
		   var url = "../group_topic_edit";
		   
		   $.ajax({ url:url , 
   		    type:"post",
   		    data:{
   		    	topic_id:topic_id,
   		    	topic_name:topic_name,
   		    	topic_content:topic_content
   		    	
   		    },
		    success: function(result){
		    	   alert(result);
		           
		           if('success'==result){
		        	   $.ajax({ url: "../query_homeGroup_topic_detail/"+topic_id, 
		    		       success: function(result){
		    	           $("#mainPageDiv").html(result);
		    	        }
		    	       });
		           }
		    	   
	         }
	        });
   }

</script>
<title>筑学堂家园个人空间</title>
<style type="text/css">
a {
	color:#222;
}
a:hover {
	color:#888;
}
li {
	list-style-type:none;
	border:none;
}
</style>
</head>
<body style="align:center; padding:0;margin:0;clear:both; background-color:FFF;">
  <div class="home_group">
			<div class="home_groupnotice" style="min-height:60px;">
				<div class="home_grnottit" style="margin-top:20px;margin-bottom:30px;"> 编辑话题</div>
				<div class="home_groupnot" style="padding-top:20px;padding-left:10px;"> 
				<span style="font-weight:bold">话题名称：</span>
				<input style="width:500px;height:26px;margin:0;padding:0;" type="text" id="topic_name" value="${data.topic_nm}"/>
				<br/>
				<br/>
				<span style="font-weight:bold;vertical-align:top;">话题详情：</span>
				<textarea style="width:500px;height:150px;" id="topic_txt">${data.topic_txt}</textarea>

					
				</div>
				
				<div class="blogadd_title01" style="width:98%;margin-top:40px;">
				<a href="#" onclick="editTopic(${data.id})">
			  <div class="blogadd_textadd" style="position:relative;float:left;left:35%;background-color:#209E85;"> 修改话题 </div>
			</a>
			
			 <div style="position:relative;float:left;left:35%;margin-left:10px;">
			    <a href="#" onclick="cancelEdit(${data.id})"> 取消</a>
			 </div>
		</div>
				
			</div>
		</div>
</body>
</html>